<?php $this->load->view('admin/public/head.html', array('css' => array(
'/assets/admin/css/admin/common.css',
'/assets/library/plugins/daterangepicker/daterangepicker.css',
'/assets/library/plugins/timepicker/bootstrap-timepicker.min.css'
))); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper gu-bbs" ng-controller="admin-bbs-slider-edit-controller">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            社区管理
            <small>前后台用户发帖管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 后台首页</a></li>
            <li class="active"><a href="/bbs/lists/index">幻灯列表</a></li>
            <li class="active">编辑广告</li>
        </ol>
    </section>

    <section class="content bbs-publish">
        <div class="row">
            <div class="col-md-12">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">编辑广告</h3>
                    </div>
                    <!-- /.box-header -->

                    <!-- form start -->
                    <form class="form-horizontal">
                        <div class="box-body">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">广告标题</label>
                                <div class="col-sm-7">
                                    <input type="text" ng-model="title" class="form-control" id="title" placeholder="广告标题">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">广告来源</label>
                                <div class="col-sm-5">
                                    <input type="text" ng-model="source" class="form-control" id="company" placeholder="广告商名称">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="reservationtime" class="col-sm-2 control-label">投放时间</label>

                                <div class="col-sm-5">
                                    <div class="input-group">
                                        <div class="input-group-addon">
                                            <i class="fa fa-clock-o"></i>
                                        </div>
                                        <input type="text" class="form-control pull-right" ng-model="times" id="reservationtime">
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">幻灯图片</label>
                                <div class="col-sm-9">
                                    <div class="bbs-img-adv" ng-show="viewThumb != ''">
                                        <img ng-src="{{ viewThumb }}" alt="">
                                    </div>
                                    <a href="javascript:void(0);" class="bbs-add-btn" id="thumbBtn">&nbsp;&nbsp;</a>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">广告类型</label>
                                <div class="col-sm-8">
                                    <p class="help-block gu-bbs-selecter">
                                        <span class="exp-btn" ng-click="setType('link')">
                                            <i class="fa" ng-class="{'fa-dot-circle-o': type == 'link', 'text-green': type == 'link', 'fa-circle-o': type != 'link'}"></i>
                                            链接
                                        </span>
                                        <span class="exp-btn" ng-click="setType('base')">
                                            <i class="fa" ng-class="{'fa-dot-circle-o': type == 'base', 'text-green': type == 'base', 'fa-circle-o': type != 'base'}"></i>
                                            基地
                                        </span>
                                        <span class="exp-btn" ng-click="setType('product')">
                                            <i class="fa" ng-class="{'fa-dot-circle-o': type == 'product', 'text-green': type == 'product', 'fa-circle-o': type != 'product'}"></i>
                                            商品
                                        </span>
                                    </p>
                                </div>
                            </div>

                            <div class="form-group" ng-show="type == 'link'">
                                <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-5">
                                    <div class="input-group">
                                        <div class="input-group-addon">
                                            <i class="fa fa-link"></i>
                                        </div>
                                        <input type="text" ng-model="linkValue" class="form-control pull-right">
                                    </div>
                                </div>
                            </div>

                            <div class="form-group" ng-show="type == 'base'">
                                <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-7">
                                    <table ng-show="selectedBase && selectedBase.id > 0" class="table table-bordered base-lists">
                                        <tr>
                                            <th class="text-center" style="width: 40px">#</th>
                                            <th class="text-center" style="width: 60px;">图片</th>
                                            <th>基地名称</th>
                                            <th class="text-center" style="width: 70px;">负责人</th>
                                            <th class="text-center" style="width: 120px;">创建时间</th>
                                            <th class="text-center" style="width: 80px">状态</th>
                                        </tr>
                                        <tr>
                                            <td class="text-center" ng-bind="selectedBase.id"></td>
                                            <td class="text-center">
                                                <img ng-src="{{ selectedBase.thumb }}" onerror="this.src='/assets/admin/img/nothumb.png'" class="base-thumb">
                                            </td>
                                            <td><a href="/farm/base/edit?baseId={{ selectedBase.id }}" target="_blank" ng-bind="selectedBase.name"></a></td>
                                            <td class="text-center" ng-bind="selectedBase.charger"></td>
                                            <td class="text-center" ng-bind="selectedBase.created"></td>
                                            <td class="text-center">
                                                <span class="badge bg-green" ng-if="selectedBase.status == 1">正常</span>
                                                <span class="badge bg-warning" ng-if="!selectedBase.status">关闭</span>
                                            </td>
                                        </tr>
                                    </table>
                                    <a href="javascript:void(0);" ng-click="selectBase()" class="btn btn-warning">
                                        <i class="fa fa-plus"></i>
                                        选择基地
                                    </a>
                                </div>
                            </div>

                            <div class="form-group" ng-show="type == 'product'">
                                <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-7">
                                    <table ng-show="selectedProduct && selectedProduct.id > 0" class="table table-bordered base-lists">
                                        <tr>
                                            <th class="text-center" style="width: 40px">#</th>
                                            <th class="text-center" style="width: 60px;">图片</th>
                                            <th>产品名称</th>
                                            <th class="text-center" style="width: 70px;">基地</th>
                                            <th class="text-center" style="width: 120px;">创建时间</th>
                                            <th class="text-center" style="width: 80px">状态</th>
                                        </tr>
                                        <tr>
                                            <td class="text-center" ng-bind="selectedProduct.id"></td>
                                            <td class="text-center">
                                                <img ng-src="{{ selectedProduct.thumb }}" onerror="this.src='/assets/admin/img/nothumb.png'" class="base-thumb">
                                            </td>
                                            <td><a href="/farm/base/edit?baseId={{ selectedProduct.id }}" target="_blank" ng-bind="selectedProduct.goodsName"></a></td>
                                            <td class="text-center" ng-bind="selectedProduct.baseName"></td>
                                            <td class="text-center" ng-bind="selectedProduct.created"></td>
                                            <td class="text-center">
                                                <span class="badge bg-green" ng-if="selectedProduct.status == 1">正常</span>
                                                <span class="badge bg-warning" ng-if="!selectedProduct.status">关闭</span>
                                            </td>
                                        </tr>
                                    </table>
                                    <a href="javascript:void(0);" ng-click="selectProduct()" class="btn btn-success">
                                        <i class="fa fa-plus"></i>
                                        选择商品
                                    </a>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <a href="/bbs/slider" class="btn btn-default">返回列表</a>
                            <button type="submit" class="btn btn-info pull-right" ng-click="modify()">确定修改</button>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
                <!-- /.box -->
            </div>
        </div>
    </section>

    <!-- 模态框 -->
    <div class="modal fade" id="selectModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">选择基地</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-body">
                                    <table class="table table-bordered base-lists">
                                        <tr>
                                            <th class="text-center" style="width: 40px">#</th>
                                            <th class="text-center" style="width: 60px;">图片</th>
                                            <th>基地名称</th>
                                            <th class="text-center" style="width: 80px">选择</th>
                                        </tr>
                                        <tr ng-repeat="(index, b) in bases">
                                            <td class="text-center" ng-bind="b.id"></td>
                                            <td class="text-center">
                                                <img ng-src="{{ b.thumb }}" onerror="this.src='/assets/admin/img/nothumb.png'" class="base-thumb">
                                            </td>
                                            <td><a href="/farm/base/edit?baseId={{ b.id }}" target="_blank" ng-bind="b.name"></a></td>
                                            <td class="text-center">
                                                <a href="javascript:void(0);" ng-click="selectBaseItem(index)" class="btn btn-xs btn-link"><i class="fa fa-search"></i> 选择</a>
                                            </td>
                                        </tr>
                                        <tr ng-show="bases.length == 0">
                                            <td colspan="4"><p class="help-block text-center">
                                                暂无数据
                                            </p></td>
                                        </tr>
                                    </table>
                                </div>
                                <!-- /.box-body -->
                                <div class="box-footer clearfix" ng-show="baseTotalPage > 1">
                                    <ul class="pagination pagination-sm no-margin pull-right">
                                        <li ng-show="baseNowPage > 1" ng-click="basePage(baseNowPage - 1)"><a href="javascript:void(0);">上一页</a></li>
                                        <li ng-show="baseTotalPage > baseNowPage" ng-click="basePage(baseNowPage + 1)"><a href="javascript:void(0);">下一页</a></li>
                                    </ul>
                                </div>
                            </div>
                            <!-- /.box -->
                        </div>
                    </div>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->
    <!-- 模态框 -->
    <div class="modal fade" id="selectModalForProduct">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">选择产品</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-body">
                                    <table class="table table-bordered base-lists">
                                        <tr>
                                            <th class="text-center" style="width: 40px">#</th>
                                            <th class="text-center" style="width: 60px;">图片</th>
                                            <th>产品名称</th>
                                            <th class="text-center" style="width: 80px;">分类</th>
                                            <th class="text-center" style="width: 80px">选择</th>
                                        </tr>
                                        <tr ng-repeat="(index, p) in products">
                                            <td class="text-center" ng-bind="p.id"></td>
                                            <td class="text-center">
                                                <img ng-src="{{ p.thumb }}" onerror="this.src='/assets/admin/img/nothumb.png'" class="base-thumb">
                                            </td>
                                            <td><a href="/goods/lists/edit?goodsId={{ p.id }}" target="_blank" ng-bind="p.goodsName"></a></td>
                                            <td class="text-center" ng-bind="p.categoryName"></td>
                                            <td class="text-center">
                                                <a href="javascript:void(0);" ng-click="selectProductItem(index)" class="btn btn-xs btn-link"><i class="fa fa-search"></i> 选择</a>
                                            </td>
                                        </tr>
                                        <tr ng-show="products.length == 0">
                                            <td colspan="5"><p class="help-block text-center">
                                                暂无数据
                                            </p></td>
                                        </tr>
                                    </table>
                                </div>
                                <!-- /.box-body -->
                                <div class="box-footer clearfix" ng-show="productTotalPage > 1">
                                    <ul class="pagination pagination-sm no-margin pull-right">
                                        <li ng-show="productNowPage > 1" ng-click="productPage(productNowPage - 1)"><a href="javascript:void(0);">上一页</a></li>
                                        <li ng-show="productTotalPage > productNowPage" ng-click="productPage(productNowPage + 1)"><a href="javascript:void(0);">下一页</a></li>
                                    </ul>
                                </div>
                            </div>
                            <!-- /.box -->
                        </div>
                    </div>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->

</div>
<!-- /.content-wrapper -->
<?php $this->load->view('admin/public/foot.html', array(
    'js' => array(
        'http://cdn.staticfile.org/webuploader/0.1.0/webuploader.flashonly.min.js',
        'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment.js',
        '/assets/library/plugins/daterangepicker/daterangepicker.js',
        '/assets/admin/js/bbs/slider/edit.js'
))); ?>
